package com.ellricky.baselib.ui.xufei;

import com.andr.common.http.callback.BaseCallback;
import com.andr.common.ui.adapter.BaseRecyclerAdapter;
import com.andr.common.ui.mvp.BasePresenter;
import com.andr.common.widget.refresh.RefreshFlag;
import com.ellricky.baselib.BaseConstant;
import com.ellricky.baselib.R;
import com.ellricky.baselib.adapter.xufei.PayRecordAdapter;
import com.ellricky.baselib.cache.LocalCacheUtil;
import com.ellricky.baselib.entity.PayRecord;
import com.ellricky.baselib.ui.base.BaseRefreshActivity;
import com.ellricky.baselib.util.NewEBaseCallback;
import com.ellricky.baselib.util.NewEListCallback;

import java.util.List;

public class PayHistoryActivity extends BaseRefreshActivity<Void, BasePresenter<Void>, PayRecord> {

    private String memberId = "";

    @Override
    public void initUIView() {
        memberId = getIntent().getStringExtra(BaseConstant.KEY_ID);

        super.initUIView();

        mTvTitle.setText(R.string.base_stu_money_record);
    }

    @Override
    protected void setRefreshListener() {
        rvView.init(this, RefreshFlag.NONE);
    }

    @Override
    public int getContentLayout() {
        return R.layout.base_activity_stu_pay_history;
    }

    @Override
    protected void initParamMap() {
        super.initParamMap();
        paramMap.put("action", "renewList");
        paramMap.put("member_id", memberId);
        paramMap.put("eid", LocalCacheUtil.getUid());
    }

    @Override
    protected BaseCallback getResponseCallback() {
        return null;
    }

    @Override
    protected NewEBaseCallback getResponseCallback2() {
        return new NewEListCallback<PayRecord>(this, false) {

            @Override
            protected void onSuccess(List<PayRecord> data, String msg) {
                dataSource = data;
                rvView.onLoadFinish(data, refresh);
            }
        };
    }

    @Override
    protected BaseRecyclerAdapter<PayRecord> getRvAdapter() {
        return new PayRecordAdapter(this);
    }

    @Override
    protected String getUrlPath() {
        return "";
    }
}
